package com.ruoyi.project.curriculaplan.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.curriculaplan.domain.StCurriPlan;
import com.ruoyi.project.curriculaplan.service.StCurriPlanService;
import com.ruoyi.project.jiaowu.kaikeinqure.domain.TbKaikeInqure;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("website/curriplan")
public class StCurriPlanController extends BaseController {

    private  String prefix="system/curriplan";

    @Autowired
    private StCurriPlanService stCurriPlanService;

    @RequiresPermissions("website:curriplan:view")
    @GetMapping()
    public String plan()
    {
        return prefix + "/curriplan";
    }

    /**
     *查询开课计划列表
     */
    @RequiresPermissions("website:curriplan:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo selectStCurriPlanList(StCurriPlan stCurriPlan)
    {
        startPage();
        List<StCurriPlan> list = stCurriPlanService.selectCurriPlanList(stCurriPlan);
        for(StCurriPlan lists:list){
            if(lists.getClassmaxweek()!=null && lists.getClasslowweek()!=null){
                lists.setClassWeek(lists.getClasslowweek().toString()+"-"+lists.getClassmaxweek().toString());
            }
//            if(lists.getStulownumber()!=null && lists.getStumaxnumber()!=null){
//                lists.setStunumber(lists.getStulownumber().toString()+"-"+lists.getStumaxnumber().toString());
//            }
        }
        return getDataTable(list);
    }

}
